package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.Role;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface RolesDao extends CCPDao<Role>{
	public final String FIELD_LIST = " obj.role_id, obj.role_name, obj.role_short_name "
		 + AbstractDao.MONITER_FIELDS;
	public final String FIND_ALL_ROLES = " select " + FIELD_LIST + " from roles obj ";

	public final class RolesExtractor extends CCPResultSetExtractor<Role>{
		
		@Override
		protected Role extractResultSetData(ResultSet resultSet) throws SQLException {
		Role roles = new Role();
		roles.setRoleId(resultSet.getInt(1));
		roles.setRoleName(resultSet.getString(2));
		roles.setRoleShortName(resultSet.getString(3));
		roles.setStatus(resultSet.getBoolean(4));
		roles.setCreatedBy(resultSet.getInt(5));
		roles.setModifiedBy(resultSet.getInt(6));
		roles.setCreatedDate(resultSet.getDate(7));
		roles.setModifiedDate(resultSet.getDate(8));
		return roles;
		
		
		}
	
	}
}
